Catalog
Python
(还不太会)
https://www.runoob.com/python3/python3-basic-syntax.html
- 推导式
- 迭代器、生成器
- 函数传参
- 数据结构
- 模块、包
- 异常
- 类
Manim
Mobject
Vectorized Mobject
Mobject 显示
原点为屏幕中心
add()
, remove()
shift()
, move_to()
, next_to()
, align_to()
1 | from manim import * |
The
move_to()
method uses absolute units (measured relative to theORIGIN
),
whilenext_to()
uses relative units (measured from the mobject passed as the first argument).align_to()
usesLEFT
not as measuring units but as a way to determine the border to use for alignment. The coordinates of the borders of a mobject are determined using an imaginary bounding box around it.
Many methods in manim can be chained together. Technically, this is possible because most methods calls return the modified mobject.
right_square = Square(color=GREEN, fill_opacity=0.7).shift(2 * RIGHT).shift(UP)
Mobject 风格
1 | circle.set_stroke(color=GREEN, width=20) |
Only instances of
VMobject
implementset_stroke()
andset_fill()
. Instances ofMobject
implementset_color()
instead. The vast majority of pre-defined classes are derived fromVMobject
so it is usually safe to assume that you have access toset_stroke()
andset_fill()
.
Mobject 顺序
1 | self.add(triangle, square, circle) |
动画
动画类
1 | # some animations display mobjects, ... |
.animate
函数
1 | # animate the change of color |
animate()
is a property of all mobjects that animates the methods that come afterward.
动画持续时间
1 | self.play(square.animate.shift(UP), run_time=3) |
By default, any animation passed to
play()
lasts for exactly one second.